<?php defined('SYSPATH') OR die('No direct access allowed.'); ?>
<fieldset>
  <legend>Comments</legend>
  <ol>
    <li>
<?php foreach ($comments as $comment) { ?>
<?php	$user_id			= $user->id; ?>
<?php 	$comment_id			= $comment['id']; ?>
<?php	$comment_author		= $comment['firstname'] . ' ' . $comment['lastname']; ?>
<?php	$comment_author_id	= $comment['author']; ?>
	  <div class="comment_container">
	    <div class="comment_header">Added by <?php echo $comment_author; ?> on <?php echo date("l jS \of F Y \a\\t h:i:s A",$comment['date']); ?></div>
	    <div class="comment_content">
<?php
		switch ($comment['status'])
		{
			case 'pending':
				echo __('This post is pending');
				break;
			case 'deleted':
				echo __('This post has been deleted');
				break;
			default:
				echo $comment['content'] . PHP_EOL; 
		}
?>
	    </div>
		<div>
<?php
		if ($edit == $comment_id)
		{
			echo Form::open('blog/comment_edit');
			echo Form::textarea('content_edit',
								$comment['content'],
								array('id'	  => 'content_edit',
									  'name'  => 'content_edit',
								//	  'class' => 'tinymce',
									  'style' => 'height: 100px;
												  width: 100%;
												  border-color: #CCCCCC;
												  border-style: solid;
												  border-width: 1px;',
									 )
							   ) . PHP_EOL;
			echo Form::hidden('comment_id', $comment_id);
			echo HTML::anchor('blog', __('Cancel'));
			echo Form::submit('submit', __('Submit'), array('class' => 'submit'));
			echo Form::close();
		}
?>
		</div>
	    <div class="comment_footer">
<?php
		// check if the comment belongs to the user or admin is logged in
		if ((($comment_author_id == $user_id) || ($user_id == 23)) && ($edit != $comment_id))
		{ ?>

<span><?php echo HTML::anchor('blog/?edit=' . $comment_id, __('Edit this comment')); ?></span>

<?php	} 

		
		
?>
	    </div>
	  </div>
<?php } ?>
    </li>
  </ol>
</fieldset>
